package com.ftg.learn.controller;

import com.ftg.learn.entity.SysUser;
import com.ftg.learn.service.UserService;
import com.ftg.learn.util.PageEx;
import com.ftg.learn.util.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 布衣
 */
@RestController
@RequestMapping("/user")
@Tag(name = "用户接口")
public class UserController {

    @Resource
    UserService userService;

    @GetMapping("/list")
    @Operation(summary = "用户列表")
    public R<PageEx<SysUser>> list(
            @Parameter(description = "用户名",required = false) @RequestParam(required = false,name="username") String username,
            @Parameter(description = "页码") @RequestParam(name="pageNum") Integer pageNum,
            @Parameter(description = "页大小")@RequestParam(name="pageSize") Integer pageSize
    ) {
        return userService.list(username, pageNum, pageSize);
    }
}
